Skip to content

Adding theme support to duplicate an existing menu, export menus as custom links relative urls and import theme settings with menus#195

Open
kimcoleman wants to merge 8 commits intodevfrom
menu-cloning
Open

Adding theme support to duplicate an existing menu, export menus as custom links relative urls and import theme settings with menus#195
kimcoleman wants to merge 8 commits intodevfrom
menu-cloning

Conversation

@kimcoleman
Copy link
Member

All Submissions:

Changes proposed in this Pull Request:

This PR adds a new Custom Menus management page to the Memberlite admin area and enhances the theme import/export tools to support navigation menus.

New Features:

1. Custom Menus Admin Page (Memberlite > Custom Menus)

  • Create new navigation menus from scratch or by duplicating an existing menu
  • Duplicate any existing menu with all its menu items and hierarchy preserved
  • Delete menus with confirmation dialog
  • View all menus with their assigned locations and item counts
  • Quick access to edit menus in the native WordPress menu editor

2. Menu Export Support

  • Optionally include navigation menus when exporting theme settings
  • Select which menus to export via checkbox interface
  • Menu items are exported as custom links with relative URLs for portability across environments
  • Preserves menu item labels, targets, descriptions, CSS classes, and hierarchy

3. Menu Import Support

  • Import navigation menus from theme settings export files
  • Relative URLs are automatically converted to absolute URLs using the destination site's URL
  • Duplicate menu names are automatically numbered (e.g., "Main Menu (2)")
  • Preserves all menu item properties and parent/child relationships

4. Admin UI Improvements

  • Added "Custom Menus" tab to the Memberlite admin navigation
  • Added "Manage with Memberlite" quick link on the Appearance > Menus page
  • New CSS styles for scrollable checkbox lists and clickable rows
  • Consistent delete button styling across admin pages

How to test the changes in this Pull Request:

Testing Custom Menus Page:

  1. Navigate to Memberlite > Custom Menus in the WordPress admin.
  2. Create a new menu by entering a name and clicking "Add Menu" - verify the menu is created.
  3. Create another menu by selecting an existing menu from "Duplicate Items From" dropdown - verify menu items are copied with correct hierarchy.
  4. Use the "Duplicate" button on an existing menu - verify a copy is created with "(Copy)" appended to the name.
  5. Use the "Delete" button on a menu - verify confirmation dialog appears and menu is deleted.
  6. Click "Edit" on a menu - verify it opens the WordPress menu editor.

Testing Menu Export:

  1. Navigate to Memberlite > Tools.
  2. In the Export Settings section, check "Include Navigation Menus" checkbox.
  3. Select specific menus to export using the checkbox list.
  4. Click "Download Export File" and verify the JSON file contains a menus array with menu data.
  5. Verify menu item URLs that match the site URL are stored as relative paths (e.g., /about/ instead of https://example.com/about/).

Testing Menu Import:

  1. Create an export file with menus from one site.
  2. On another site (or after deleting the menus), navigate to Memberlite > Tools.
  3. Upload the export file and import.
  4. Verify menus are created with correct names (numbered if duplicates exist).
  5. Verify menu items have correct labels, URLs (converted to absolute), and hierarchy.

Testing Cross-Environment Portability:

  1. Export menus from a local development site.
  2. Import on a staging or production site with a different URL.
  3. Verify relative URLs are correctly converted to the new site's domain.

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you successfully run tests with your changes locally?

Changelog entry

  • FEATURE: Added new Custom Menus admin page under Memberlite > Custom Menus for creating, duplicating, and managing navigation menus.
  • ENHANCEMENT: Theme import/export now supports navigation menus with portable relative URLs for easy migration between environments.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds comprehensive navigation menu management capabilities to the Memberlite theme, including a new admin interface for menu creation and duplication, plus import/export functionality with cross-environment portability through relative URL conversion.

Changes:

  • New "Custom Menus" admin page under Memberlite menu for creating, duplicating, and managing navigation menus
  • Enhanced theme export/import tools to support navigation menus with portable relative URLs
  • UI improvements including scrollable checkbox lists, clickable rows, and consistent delete button styling

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 15 comments.

Show a summary per file
File Description
inc/admin.php Adds Custom Menus submenu page and "Manage with Memberlite" quick link on Appearance > Menus page
functions.php Includes new menus.php admin page file
css/admin.css Adds styles for scrollable checkbox boxes and clickable row elements
adminpages/tools/import-settings.php Adds menu import options UI with "Replace existing menus" checkbox
adminpages/tools/export-settings.php Adds menu export options with selectable menu checkboxes and JavaScript toggle functionality
adminpages/tools.php Implements menu export logic with relative URL conversion and import logic with URL restoration and duplicate handling
adminpages/sidebars.php Updates delete button styling for consistency
adminpages/menus.php New file implementing menu creation, duplication, deletion, and management interface
adminpages/admin_header.php Adds Custom Menus tab to navigation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@RachelRVasquez
Copy link
Collaborator

  • Custom Menus Page ✅
  • Menu Export ✅
  • Menu Import ✅

Tested all the steps based on your instructions and it looks good. Nothing in the debug log. Only thing I didn't test was to import on a staging site with Memberlite. Otherwise, all good on my end. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants